﻿
<!DOCTYPE html>
<html lang="en">
<head>

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta charset="utf-8" />

    <!-- Set the title bar of the page -->
    <title>Farmer's Revenge</title>

    <!-- Set the background colour of the document -->
    <style>
        body {
            background: #222;
            color: #cccccc;
            margin: 0px;
            padding: 0px;
            border: 0px;
        }

        canvas {
            image-rendering: optimizeSpeed;
            -webkit-interpolation-mode: nearest-neighbor;
            margin: 0px;
            padding: 0px;
            border: 0px;
        }

        :-webkit-full-screen #canvas {
            width: 100%;
            height: 100%;
        }

        div.gm4html5_div_class {
            position: fixed;
            top: 50%;
            left: 50%;
            margin-left: -512px;
            margin-top: -384px;
            padding: 0px;
            border: 0px;
        }
        /* START - Login Dialog Box */
        div.gm4html5_login {
            padding: 20px;
            position: absolute;
            border: solid 2px #000000;
            background-color: #404040;
            color: #00ff00;
            border-radius: 15px;
            box-shadow: #101010 20px 20px 40px;
        }

        div.gm4html5_cancel_button {
            float: right;
        }

        div.gm4html5_login_button {
            float: left;
        }

        div.gm4html5_login_header {
            text-align: center;
        }
        /* END - Login Dialog Box */
        :-webkit-full-screen {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body onload="onDocLoad()" onresize="onResize()">
   <script>
   function onDocLoad() {
       if(( /(ipad|iphone|ipod|android|windows phone)/i.test(navigator.userAgent) )) {
           document.addEventListener('deviceready', initApp, false);
       } else {
           initApp();
       }
   }

   function initApp() {
       initAd();

       // display the banner at startup
       window.plugins.AdMob.createBannerView();
   }
   function initAd(){
       if ( window.plugins && window.plugins.AdMob ) {
           var ad_units = {
               android : {
                   banner: 'ca-app-pub-5798084021048325/9983517696',
                   interstitial: 'ca-app-pub-5798084021048325/4355786494'
               }
           };
           var admobid = "";
           if( /(android)/i.test(navigator.userAgent) ) {
               admobid = ad_units.android;
           } else if(/(iphone|ipad)/i.test(navigator.userAgent)) {
               admobid = ad_units.ios;
           } else {
               admobid = ad_units.wp8;
           }

           window.plugins.AdMob.setOptions( {
               publisherId: admobid.banner,
               interstitialAdId: admobid.interstitial,
               bannerAtTop: false, // set to true, to put banner at top
               overlap: false, // set to true, to allow banner overlap webview
               offsetTopBar: false, // set to true to avoid ios7 status bar overlap
               isTesting: false, // receiving test ad
               autoShow: true // auto show interstitial ad when loaded
           });

           registerAdEvents();

       } else {
           alert( 'admob plugin not ready' );
       }
   }
   // optional, in case respond to events
   function registerAdEvents() {
       document.addEventListener('onReceiveAd', function(){});
       document.addEventListener('onFailedToReceiveAd', function(data){});
       document.addEventListener('onPresentAd', function(){});
       document.addEventListener('onDismissAd', function(){ });
       document.addEventListener('onLeaveToAd', function(){ });
       document.addEventListener('onReceiveInterstitialAd', function(){ });
       document.addEventListener('onPresentInterstitialAd', function(){ });
       document.addEventListener('onDismissInterstitialAd', function(){ });
   }
   function onResize() {
       var msg = 'web view: ' + window.innerWidth + ' x ' + window.innerHeight;
       document.getElementById('sizeinfo').innerHTML = msg;
   }
   </script>
   <div id="fullpage">
   <p>Demo for AdMob Plugin</p>
   <p><button onclick="window.plugins.AdMob.createBannerView();">create Ad</button> <button onclick="window.plugins.AdMob.destroyBannerView();">remove Ad</button></p>
   <p><button onclick="window.plugins.AdMob.showAd(true,function(){},function(e){alert(JSON.stringify(e));});">show Ad</button> <button onclick="window.plugins.AdMob.showAd(false);">hide Ad</button></p>
   <p><button onclick="window.plugins.AdMob.createInterstitialView();">create Interstitial Ad</button></p>
   <p><button onclick="window.plugins.AdMob.showInterstitialAd(true,function(){},function(e){alert(JSON.stringify(e));});">show Interstitial Ad</button></p>
   <div id="sizeinfo">width * height</div>
   <div>Try rotate screen to test the orientation change</div>

   </div>

   </body>
</html>

<body>
    <div class="gm4html5_div_class" id="gm4html5_div_id">
        <img src="SAM/splash.png" id="GM4HTML5_loadingscreen" alt="smilegame:HTML5 loading screen" style="display:none;" />
        <!-- Create the canvas element the game draws to -->
        <canvas id="canvas" width="1024" height="768">
            <p>Your browser doesn't support HTML5 .</p>
        </canvas>
    </div>
    <div>
      <p> <button onclick = "showAd" (true);"> Display Ad </button></p>
      <p> <button onclick = "showAd" (false);"> Hide Ads </button></p>
    </div>
    <!-- The admob ads -->
    <script type="text/javascript" src="js/admob.js"></script>
    <!-- Run the game code -->
    <script type="text/javascript" src="SAM/index.js?HFBYB=243841099"></script>


</body>
</html>
